//
//  QueryCitySeleCell.m
//  carcareIOS
//
//  Created by 王然 on 16/8/2.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "BRCarInfoCitySeleCell.h"

#define CELL_HEIGHT (60)

#define Word_Color (COLOR_HEXSTRING(@"#424242"))

#define Word_Wrong_Color (COLOR_HEXSTRING(@"#fd6500"))

#define Word_Gray_Color (COLOR_RGBA(208, 208, 213, 1))

@interface BRCarInfoCitySeleCell()

@property (nonatomic , strong) UILabel * leftL;

@property (nonatomic , strong) UILabel * rightL;

@end

@implementation BRCarInfoCitySeleCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createUI];
        
    }
    return self;
}
- (void)createUI
{
    
    CGFloat labelX = 15 * __MAIN_RATIO_375;
    
    CGFloat leftLW = 70;
    self.leftL = [[UILabel labelWithFrame:CGRectMake(labelX, 0, leftLW, CELL_HEIGHT) font:FONT_DEFAULT_Light(16) text:@"" textColor:[Theme wordColor]] setupOnView:self];
    
    UIImage * rightImage = ImageNamed(@"cell_right");
    [Factory imageViewWithCenter: CGPointMake(__MAIN_WIDTH - 25, CELL_HEIGHT / 2) image:rightImage onView:self];
    CGFloat rightLW = __MAIN_WIDTH - self.leftL.right - (rightImage.size.width + 25);
    
    self.rightL = [[[UILabel labelWithFrame:CGRectMake(self.leftL.right, 0, rightLW, CELL_HEIGHT) font:FONT_DEFAULT_Light(15) text:@"" textColor:Word_Color] setupOnView:self] labelResetTextAlignment:NSTextAlignmentRight];
    
    [[[UIView viewWithFrame:CGRectMake(0, 0, __MAIN_WIDTH, 0.5)] setupOnView:self] resetBackgroundColor:[Theme lineColor]];
    [[[UIView viewWithFrame:CGRectMake(0, CELL_HEIGHT , __MAIN_WIDTH, 0.5)] setupOnView:self] resetBackgroundColor:[Theme lineColor]];
}
- (void)reloadleftTitle:(NSString *)leftStr rightTItle:(NSString *)rightStr
{
    self.rightL.textColor = ([rightStr isEqualToString:@"请选择查询城市"] ? Word_Gray_Color : Word_Color);

    self.leftL.text = leftStr;
    self.rightL.text = rightStr;
}
- (void)reloadTextColorIsWrong:(BOOL)isWrong
{
    [self.leftL setTextColor:(isWrong ? Word_Wrong_Color : Word_Color)];
    
    [self.rightL setTextColor:(isWrong ? Word_Wrong_Color : Word_Gray_Color)];
}
+ (CGFloat)getCellHeight
{
    return CELL_HEIGHT;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
